var CmsPhotoEditControl = Class.create(FormControl, {
    photoId: null,

    loadPhoto: function(id)
    {
        this.photoId = id;
        this.setParam('photo_id', id);
    },

    observeEvent: function($super)
    {
        $super();
        var me = this;
        this.find('.link_button.setDefault').invoke('observe', 'click', function(){
            me.processAction('SetDefaultPhoto');
            me.fire('setDefault', me.photoId);
        });
        this.find('.link_button.delete').invoke('observe', 'click', this.deletePhoto.bind(this));
    },

    deletePhoto: function()
    {
		if (confirm('Are you sure you want to delete this photo?'))
		{
			this.processAction('DeletePhoto');
		}
    }
});